<template>
  <div class="cinema-container">
    <header class="cinema-header">
      <h1>田园电影院</h1>
      <p>探索电影的无限魅力，与田园一同绽放光彩！</p>
      <div class="header-decor"></div>
    </header>

    <section class="movie-showcase">
      <div class="movie-card" v-for="movie in movies" :key="movie.id">
        <div class="movie-poster-container">
          <img :src="getPosterPath(movie.poster)" :alt="movie.title" class="movie-poster">
        </div>
        <div class="movie-details">
          <h2>{{ movie.title }}</h2>
          <p>{{ movie.description }}</p>
          <a :href="movie.watchLink" class="watch-btn" target="_blank">观看预告</a>
        </div>
      </div>
    </section>

    <footer class="cinema-footer">
      <p>感谢您的光临，期待您再次走进田园电影院！</p>
      <div class="footer-decor"></div>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'Index',
  data() {
    return {
      movies: [
        {
          id: 1,
          title: '彷徨之刃',
          description: '一部扣人心弦的悬疑电影，探寻正义与复仇的边界。',
          poster: '1.jpg',
          watchLink: 'https://baike.baidu.com/item/%E5%BD%B7%E5%BE%A8%E4%B9%8B%E5%88%83/22360393?fr=ge_ala'
        },
        {
          id: 2,
          title: '怒潮',
          description: '一部充满激情的动作电影，感受肾上腺素的飙升。',
          poster: '2.jpg',
          watchLink: 'https://baike.baidu.com/item/%E6%80%92%E6%BD%AE/63671445?fr=ge_ala'
        },
        {
          id: 3,
          title: '灿烂的她',
          description: '一部浪漫的爱情电影，讲述了一段美好的爱情故事。',
          poster: '3.jpg',
          watchLink: 'https://baike.baidu.com/item/%E7%81%BF%E7%83%82%E7%9A%84%E5%A5%B9/63289520?fr=ge_ala'
        },
        {
          id: 4,
          title: '来福大酒店',
          description: '一部喜剧电影，带你走进一个充满欢笑的世界。',
          poster: '4.jpg',
          watchLink: 'https://baike.baidu.com/item/%E6%9D%A5%E7%A6%8F%E5%A4%A7%E9%85%92%E5%BA%97/60041909?fr=ge_ala'
        }
      ]
    };
  },
  methods: {
    getPosterPath(posterName) {
      return require(`@/assets/posters/${posterName}`);
    }
  }
};
</script>

<style scoped>
.cinema-container {
  font-family: 'Arial', sans-serif;
  color: #333;
  background-color: #f4f4f9;
  padding: 40px;
  margin: 0 auto;
  max-width: 1400px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
  animation: backgroundAnimation 10s infinite alternate;
}
@keyframes backgroundAnimation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
.cinema-header {
  text-align: center;
  margin-bottom: 60px;
  position: relative;
}

.cinema-header h1 {
  font-size: 48px;
  margin: 0;
  color: #555;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.cinema-header p {
  font-size: 24px;
  color: #666;
}

.header-decor {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 10px;
  background-image: linear-gradient(to right, #ff7e5f, #feb47b);
}

.movie-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 80px;
}

.movie-card {
  width: 100%;
  background-color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.movie-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.movie-poster-container {
  overflow: hidden;
  height: 400px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
  transition: background 0.3s ease;
}

.movie-poster {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Resize posters to cover the container */
  display: block;
  transition: transform 0.5s ease;
}

.movie-card:hover .movie-poster {
  transform: scale(1.1);
}
.movie-card:hover .movie-poster-container {
  background: none;
}
.movie-details {
  padding: 20px;
}

.movie-details h2 {
  font-size: 32px;
  color: #555;
  margin: 0 0 15px;
}

.movie-details p {
  font-size: 18px;
  color: #666;
  margin-bottom: 30px;
}

.watch-btn {
  background-color: #5cb85c;
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background-image: linear-gradient(to right, #5cb85c, #4cae4c);
  transition: background-image 0.3s ease;
}

.watch-btn:hover {
  background-image: linear-gradient(to left, #5cb85c, #4cae4c);
}

.cinema-footer {
  text-align: center;
  font-size: 24px;
  color: #555;
  position: relative;
  margin-top: 80px;
}

.footer-decor {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 10px;
  background-image: linear-gradient(to right, #5cb85c, #8bc34a);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.movie-card {
  animation: fadeIn 1s ease-out forwards;
}
</style>
